/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * @author Victor Varias Perez
 * Cluster y grupo: C8G3
 * Created on 24-may-2010, 1:46:34
 * Objetivo de la clase: Capa de presentación
 * Clases utilizadas: Jugador
 */

package Presentacion;
import Dominio.*;
import javax.swing.ImageIcon;
import java.util.ArrayList;
/**
 *
 * @author Viktor
 */
public class GUIJugador extends javax.swing.JFrame {
    /**
     * Nos informa si el usuario ya ha realizado la accion
     */
    boolean decision;
    /**
     * el padre
     */
    GUIRemigio padre;
    /**
     * cierto si el jugador tiene 10 cartas en su mano, si tiene 11 es falso
     */
    boolean diezcartas;
    /**
     * Jugada que ha realizado el jugador
     */
    Jugada jug;
    /**
     * mano del jugador actual
     */
    Mazo mano;
    JugadorRemigio jugador;
    PartidaRemigio partida;

    /** Creates new form jug */
    public GUIJugador() {
        //decision = false;
        initComponents();
        JugadorGui.setVisible(false);
        TurnoGui.setVisible(true);
        this.getRootPane().setContentPane(TurnoGui);
        errordescarte.setVisible(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JugadorGui = new javax.swing.JPanel();
        Carta8 = new javax.swing.JLabel();
        Carta6 = new javax.swing.JLabel();
        Carta7 = new javax.swing.JLabel();
        Carta9 = new javax.swing.JLabel();
        Carta10 = new javax.swing.JLabel();
        Carta1 = new javax.swing.JLabel();
        Carta2 = new javax.swing.JLabel();
        Carta3 = new javax.swing.JLabel();
        Carta4 = new javax.swing.JLabel();
        Carta5 = new javax.swing.JLabel();
        Carta11 = new javax.swing.JLabel();
        Baraja = new javax.swing.JButton();
        jLabel22 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        Cerrar = new javax.swing.JButton();
        NDescartar = new javax.swing.JTextField();
        Descartar = new javax.swing.JButton();
        InfoJug1 = new javax.swing.JLabel();
        PuntJug1 = new javax.swing.JLabel();
        PuntJug2 = new javax.swing.JLabel();
        InfoJug2 = new javax.swing.JLabel();
        PuntJug3 = new javax.swing.JLabel();
        InfoJug3 = new javax.swing.JLabel();
        PuntJug4 = new javax.swing.JLabel();
        InfoJug4 = new javax.swing.JLabel();
        PuntJug5 = new javax.swing.JLabel();
        InfoJug5 = new javax.swing.JLabel();
        PuntJug6 = new javax.swing.JLabel();
        InfoJug6 = new javax.swing.JLabel();
        PuntJug7 = new javax.swing.JLabel();
        InfoJug7 = new javax.swing.JLabel();
        CambioCarta67 = new javax.swing.JButton();
        CambioCarta78 = new javax.swing.JButton();
        CambioCarta89 = new javax.swing.JButton();
        CambioCarta910 = new javax.swing.JButton();
        CambioCarta12 = new javax.swing.JButton();
        CambioCarta23 = new javax.swing.JButton();
        CambioCarta34 = new javax.swing.JButton();
        CambioCarta45 = new javax.swing.JButton();
        CambioCarta511 = new javax.swing.JButton();
        CambioCarta1011 = new javax.swing.JButton();
        Descarte = new javax.swing.JButton();
        n1 = new javax.swing.JLabel();
        n2 = new javax.swing.JLabel();
        n3 = new javax.swing.JLabel();
        n4 = new javax.swing.JLabel();
        n5 = new javax.swing.JLabel();
        n6 = new javax.swing.JLabel();
        n7 = new javax.swing.JLabel();
        n8 = new javax.swing.JLabel();
        n9 = new javax.swing.JLabel();
        n10 = new javax.swing.JLabel();
        n11 = new javax.swing.JLabel();
        errordescarte = new javax.swing.JLabel();
        BotonAbortar = new javax.swing.JButton();
        BotonGuardar = new javax.swing.JButton();
        TurnoGui = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        NombreJugador = new javax.swing.JLabel();
        Mostrar = new javax.swing.JButton();
        GuardarNombreGui = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        nombrepart = new javax.swing.JTextField();
        aceptarguardar = new javax.swing.JButton();
        CancelarGuardar = new javax.swing.JButton();
        ParticionGui = new javax.swing.JPanel();
        Carta05 = new javax.swing.JLabel();
        Carta011 = new javax.swing.JLabel();
        n12 = new javax.swing.JLabel();
        Carta04 = new javax.swing.JLabel();
        Carta010 = new javax.swing.JLabel();
        Carta01 = new javax.swing.JLabel();
        Carta07 = new javax.swing.JLabel();
        Carta09 = new javax.swing.JLabel();
        Carta08 = new javax.swing.JLabel();
        Carta06 = new javax.swing.JLabel();
        Carta02 = new javax.swing.JLabel();
        Carta03 = new javax.swing.JLabel();
        n13 = new javax.swing.JLabel();
        n14 = new javax.swing.JLabel();
        n15 = new javax.swing.JLabel();
        n16 = new javax.swing.JLabel();
        n17 = new javax.swing.JLabel();
        n18 = new javax.swing.JLabel();
        n19 = new javax.swing.JLabel();
        n20 = new javax.swing.JLabel();
        n21 = new javax.swing.JLabel();
        n22 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        Labelagrup1 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox();
        jComboBox3 = new javax.swing.JComboBox();
        Labelagrup2 = new javax.swing.JLabel();
        Labelagrup3 = new javax.swing.JLabel();
        jComboBox5 = new javax.swing.JComboBox();
        Labelagrup4 = new javax.swing.JLabel();
        Labelagrup5 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        cart11 = new javax.swing.JTextField();
        cart12 = new javax.swing.JTextField();
        cart13 = new javax.swing.JTextField();
        cart14 = new javax.swing.JTextField();
        cart15 = new javax.swing.JTextField();
        cart16 = new javax.swing.JTextField();
        cart17 = new javax.swing.JTextField();
        cart21 = new javax.swing.JTextField();
        cart22 = new javax.swing.JTextField();
        cart23 = new javax.swing.JTextField();
        cart24 = new javax.swing.JTextField();
        cart25 = new javax.swing.JTextField();
        cart26 = new javax.swing.JTextField();
        cart27 = new javax.swing.JTextField();
        cart31 = new javax.swing.JTextField();
        cart32 = new javax.swing.JTextField();
        cart33 = new javax.swing.JTextField();
        cart34 = new javax.swing.JTextField();
        cart41 = new javax.swing.JTextField();
        cart42 = new javax.swing.JTextField();
        cart51 = new javax.swing.JTextField();
        cart52 = new javax.swing.JTextField();
        Aceptarparticion = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Remigio - PROP");

        Carta8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta8.setText("jLabel11");
        Carta8.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta8.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta8.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta6.setText("jLabel11");
        Carta6.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta6.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta6.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta7.setText("jLabel11");
        Carta7.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta7.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta7.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta9.setText("jLabel11");
        Carta9.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta9.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta9.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta10.setText("jLabel11");
        Carta10.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta10.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta10.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta1.setText("jLabel11");
        Carta1.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta1.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta1.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta2.setText("jLabel11");
        Carta2.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta2.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta2.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta3.setText("jLabel11");
        Carta3.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta3.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta3.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta4.setText("jLabel11");
        Carta4.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta4.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta4.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta5.setText("jLabel11");
        Carta5.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta5.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta5.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta11.setText("jLabel11");
        Carta11.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta11.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta11.setPreferredSize(new java.awt.Dimension(73, 100));

        Baraja.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/baraja.gif"))); // NOI18N
        Baraja.setMaximumSize(new java.awt.Dimension(135, 100));
        Baraja.setMinimumSize(new java.awt.Dimension(135, 100));
        Baraja.setPreferredSize(new java.awt.Dimension(135, 100));
        Baraja.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BarajaActionPerformed(evt);
            }
        });

        jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel22.setText("Baraja");

        jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel24.setText("Descarte");

        Cerrar.setText("Cerrar");
        Cerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CerrarActionPerformed(evt);
            }
        });

        Descartar.setText("Descartar");
        Descartar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DescartarActionPerformed(evt);
            }
        });

        InfoJug1.setText("InfoJug1");

        PuntJug1.setText("PuntJug1");

        PuntJug2.setText("PuntJug12");

        InfoJug2.setText("InfoJug2");

        PuntJug3.setText("PuntJug3");

        InfoJug3.setText("InfoJug3");

        PuntJug4.setText("PuntJug4");

        InfoJug4.setText("InfoJug4");

        PuntJug5.setText("PuntJug5");

        InfoJug5.setText("InfoJug5");

        PuntJug6.setText("PuntJug6");

        InfoJug6.setText("InfoJug6");

        PuntJug7.setText("PuntJug7");

        InfoJug7.setText("InfoJug7");

        CambioCarta67.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi.gif"))); // NOI18N
        CambioCarta67.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta67.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta67.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta67.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta67ActionPerformed(evt);
            }
        });

        CambioCarta78.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi.gif"))); // NOI18N
        CambioCarta78.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta78.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta78.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta78.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta78ActionPerformed(evt);
            }
        });

        CambioCarta89.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi.gif"))); // NOI18N
        CambioCarta89.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta89.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta89.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta89.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta89ActionPerformed(evt);
            }
        });

        CambioCarta910.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi.gif"))); // NOI18N
        CambioCarta910.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta910.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta910.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta910.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta910ActionPerformed(evt);
            }
        });

        CambioCarta12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi2.gif"))); // NOI18N
        CambioCarta12.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta12.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta12.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta12ActionPerformed(evt);
            }
        });

        CambioCarta23.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi2.gif"))); // NOI18N
        CambioCarta23.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta23.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta23.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta23ActionPerformed(evt);
            }
        });

        CambioCarta34.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi2.gif"))); // NOI18N
        CambioCarta34.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta34.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta34.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta34.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta34ActionPerformed(evt);
            }
        });

        CambioCarta45.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi2.gif"))); // NOI18N
        CambioCarta45.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta45.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta45.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta45.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta45ActionPerformed(evt);
            }
        });

        CambioCarta511.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi2.gif"))); // NOI18N
        CambioCarta511.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta511.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta511.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta511.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta511ActionPerformed(evt);
            }
        });

        CambioCarta1011.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/canvi.gif"))); // NOI18N
        CambioCarta1011.setMaximumSize(new java.awt.Dimension(23, 17));
        CambioCarta1011.setMinimumSize(new java.awt.Dimension(23, 17));
        CambioCarta1011.setPreferredSize(new java.awt.Dimension(23, 17));
        CambioCarta1011.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CambioCarta1011ActionPerformed(evt);
            }
        });

        Descarte.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Descarte.setMaximumSize(new java.awt.Dimension(73, 100));
        Descarte.setMinimumSize(new java.awt.Dimension(73, 100));
        Descarte.setPreferredSize(new java.awt.Dimension(73, 100));
        Descarte.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DescarteActionPerformed(evt);
            }
        });

        n1.setText("1");

        n2.setText("2");

        n3.setText("3");

        n4.setText("4");

        n5.setText("5");

        n6.setText("6");

        n7.setText("7");

        n8.setText("8");

        n9.setText("9");

        n10.setText("10");

        n11.setText("11");

        errordescarte.setText("Fuera de rango");

        BotonAbortar.setText("Abortar");
        BotonAbortar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonAbortarActionPerformed(evt);
            }
        });

        BotonGuardar.setText("Guardar");
        BotonGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonGuardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout JugadorGuiLayout = new javax.swing.GroupLayout(JugadorGui);
        JugadorGui.setLayout(JugadorGuiLayout);
        JugadorGuiLayout.setHorizontalGroup(
            JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JugadorGuiLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug1)
                            .addComponent(PuntJug1))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug2)
                            .addComponent(PuntJug2))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug3)
                            .addComponent(PuntJug3))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug4)
                            .addComponent(PuntJug4))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug5)
                            .addComponent(PuntJug5))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug6)
                            .addComponent(PuntJug6))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(InfoJug7)
                            .addComponent(PuntJug7)))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                                        .addComponent(Carta1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Carta2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(Baraja, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                                .addComponent(Carta3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(Carta4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(Carta5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(Carta11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(CambioCarta511, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                                .addComponent(Descarte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(errordescarte)
                                                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                                                        .addComponent(NDescartar, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18, 18, 18)
                                                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                            .addComponent(Cerrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(Descartar)))))))
                                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel24))))
                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                .addComponent(Carta6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(Carta7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(Carta8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(Carta9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(Carta10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(CambioCarta1011, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(n11, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
                            .addComponent(BotonGuardar)))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(n6, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta67, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(n7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta78, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(n8, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta89, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(24, 24, 24)
                        .addComponent(n9, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta910, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(n10)
                        .addGap(133, 133, 133)
                        .addComponent(BotonAbortar, javax.swing.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(n1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(25, 25, 25)
                        .addComponent(n2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(25, 25, 25)
                        .addComponent(n3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(n4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(CambioCarta45, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(n5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        JugadorGuiLayout.setVerticalGroup(
            JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JugadorGuiLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(JugadorGuiLayout.createSequentialGroup()
                                    .addComponent(InfoJug1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(PuntJug1))
                                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(InfoJug2)
                                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                                        .addGap(20, 20, 20)
                                        .addComponent(PuntJug2))))
                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                .addComponent(InfoJug3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PuntJug3))
                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                .addComponent(InfoJug4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PuntJug4))
                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                .addComponent(InfoJug5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(PuntJug5)))
                        .addGroup(JugadorGuiLayout.createSequentialGroup()
                            .addComponent(InfoJug6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(PuntJug6)))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addComponent(InfoJug7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(PuntJug7)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JugadorGuiLayout.createSequentialGroup()
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(Descarte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Baraja, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel22)
                            .addComponent(jLabel24)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JugadorGuiLayout.createSequentialGroup()
                        .addComponent(Cerrar)
                        .addGap(18, 18, 18)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Descartar)
                            .addComponent(NDescartar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(errordescarte)
                        .addGap(8, 8, 8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CambioCarta12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CambioCarta23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CambioCarta34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(n1, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(n2, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(n3, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(8, 8, 8))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(n4)
                            .addComponent(CambioCarta45, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(JugadorGuiLayout.createSequentialGroup()
                                .addComponent(n5)
                                .addGap(3, 3, 3)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Carta1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta2, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta4, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta5, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Carta6, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta7, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta8, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta9, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Carta10, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addComponent(CambioCarta511, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(35, 35, 35)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Carta11, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(n11))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(CambioCarta1011, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BotonGuardar))))
                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CambioCarta67, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CambioCarta89, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(n6)
                            .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(n7)
                                .addComponent(CambioCarta78, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(n8))
                            .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(n9)
                                .addGroup(JugadorGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(n10)
                                    .addComponent(CambioCarta910, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(JugadorGuiLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(BotonAbortar)))
                .addContainerGap())
        );

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 36));
        jLabel1.setText("Turno del Jugador:");

        NombreJugador.setFont(new java.awt.Font("Tahoma", 0, 36));
        NombreJugador.setText("NombreJugador");

        Mostrar.setText("Aceptar");
        Mostrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MostrarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout TurnoGuiLayout = new javax.swing.GroupLayout(TurnoGui);
        TurnoGui.setLayout(TurnoGuiLayout);
        TurnoGuiLayout.setHorizontalGroup(
            TurnoGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TurnoGuiLayout.createSequentialGroup()
                .addGroup(TurnoGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(TurnoGuiLayout.createSequentialGroup()
                        .addGap(101, 101, 101)
                        .addGroup(TurnoGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(NombreJugador)
                            .addComponent(jLabel1)))
                    .addGroup(TurnoGuiLayout.createSequentialGroup()
                        .addGap(206, 206, 206)
                        .addComponent(Mostrar)))
                .addContainerGap(195, Short.MAX_VALUE))
        );
        TurnoGuiLayout.setVerticalGroup(
            TurnoGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(TurnoGuiLayout.createSequentialGroup()
                .addGap(75, 75, 75)
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(NombreJugador)
                .addGap(18, 18, 18)
                .addComponent(Mostrar)
                .addContainerGap(311, Short.MAX_VALUE))
        );

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
        jLabel2.setText("Guardar partida");

        jLabel3.setText("Introduce el nombre con el que quieres guardar la partida");

        aceptarguardar.setText("Guardar");
        aceptarguardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aceptarguardarActionPerformed(evt);
            }
        });

        CancelarGuardar.setText("Cancelar");
        CancelarGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CancelarGuardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout GuardarNombreGuiLayout = new javax.swing.GroupLayout(GuardarNombreGui);
        GuardarNombreGui.setLayout(GuardarNombreGuiLayout);
        GuardarNombreGuiLayout.setHorizontalGroup(
            GuardarNombreGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(GuardarNombreGuiLayout.createSequentialGroup()
                .addGap(156, 156, 156)
                .addGroup(GuardarNombreGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addComponent(nombrepart, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(147, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, GuardarNombreGuiLayout.createSequentialGroup()
                .addContainerGap(405, Short.MAX_VALUE)
                .addComponent(CancelarGuardar)
                .addGap(18, 18, 18)
                .addComponent(aceptarguardar)
                .addContainerGap())
        );
        GuardarNombreGuiLayout.setVerticalGroup(
            GuardarNombreGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(GuardarNombreGuiLayout.createSequentialGroup()
                .addGap(96, 96, 96)
                .addComponent(jLabel2)
                .addGap(66, 66, 66)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(nombrepart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 219, Short.MAX_VALUE)
                .addGroup(GuardarNombreGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(aceptarguardar)
                    .addComponent(CancelarGuardar))
                .addContainerGap())
        );

        Carta05.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta05.setText("jLabel11");
        Carta05.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta05.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta05.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta011.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta011.setText("jLabel11");
        Carta011.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta011.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta011.setPreferredSize(new java.awt.Dimension(73, 100));

        n12.setText("11");

        Carta04.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta04.setText("jLabel11");
        Carta04.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta04.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta04.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta010.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta010.setText("jLabel11");
        Carta010.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta010.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta010.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta01.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta01.setText("jLabel11");
        Carta01.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta01.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta01.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta07.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta07.setText("jLabel11");
        Carta07.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta07.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta07.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta09.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta09.setText("jLabel11");
        Carta09.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta09.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta09.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta08.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta08.setText("jLabel11");
        Carta08.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta08.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta08.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta06.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta06.setText("jLabel11");
        Carta06.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta06.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta06.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta02.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta02.setText("jLabel11");
        Carta02.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta02.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta02.setPreferredSize(new java.awt.Dimension(73, 100));

        Carta03.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Presentacion/cartas/reverso.gif"))); // NOI18N
        Carta03.setText("jLabel11");
        Carta03.setMaximumSize(new java.awt.Dimension(73, 100));
        Carta03.setMinimumSize(new java.awt.Dimension(73, 100));
        Carta03.setPreferredSize(new java.awt.Dimension(73, 100));

        n13.setText("6");

        n14.setText("1");

        n15.setText("2");

        n16.setText("3");

        n17.setText("4");

        n18.setText("5");

        n19.setText("7");

        n20.setText("8");

        n21.setText("9");

        n22.setText("10");

        jLabel4.setText("Numero de agrupaciones de cartas:");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "5" }));
        jComboBox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox1ActionPerformed(evt);
            }
        });

        Labelagrup1.setText("Cartas agrupación 1: ");

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "4", "5", "6", "7" }));
        jComboBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox2ActionPerformed(evt);
            }
        });

        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "4", "5", "6", "7" }));
        jComboBox3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox3ActionPerformed(evt);
            }
        });

        Labelagrup2.setText("Cartas agrupación 2: ");

        Labelagrup3.setText("Cartas agrupación 4: ");

        jComboBox5.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "4" }));
        jComboBox5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox5ActionPerformed(evt);
            }
        });

        Labelagrup4.setText("Cartas agrupación 3: ");

        Labelagrup5.setText("Cartas agrupación 5: ");

        jLabel5.setText("Cartas que componen la agrupación (una por espacio)");

        Aceptarparticion.setText("Aceptar");
        Aceptarparticion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AceptarparticionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ParticionGuiLayout = new javax.swing.GroupLayout(ParticionGui);
        ParticionGui.setLayout(ParticionGuiLayout);
        ParticionGuiLayout.setHorizontalGroup(
            ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ParticionGuiLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                                        .addComponent(Carta06, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Carta07, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Carta08, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Carta09, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Carta010, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                                        .addComponent(Carta01, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(Carta02, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel5)
                                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                                .addComponent(Carta03, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(Carta04, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(Carta05, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(Carta011, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(n12, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE))
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGap(29, 29, 29)
                                .addComponent(n13, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(67, 67, 67)
                                .addComponent(n19, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(67, 67, 67)
                                .addComponent(n20, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(65, 65, 65)
                                .addComponent(n21, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(59, 59, 59)
                                .addComponent(n22)
                                .addGap(204, 204, 204))
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGap(29, 29, 29)
                                .addComponent(n14, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(66, 66, 66)
                                .addComponent(n15, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(66, 66, 66)
                                .addComponent(n16, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(69, 69, 69)
                                .addComponent(n17, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(59, 59, 59)
                                .addComponent(n18, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Aceptarparticion)
                        .addContainerGap())
                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addGap(18, 18, 18)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(426, Short.MAX_VALUE))
                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, ParticionGuiLayout.createSequentialGroup()
                                .addComponent(Labelagrup5)
                                .addGap(67, 67, 67)
                                .addComponent(cart51, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, ParticionGuiLayout.createSequentialGroup()
                                .addComponent(Labelagrup3)
                                .addGap(67, 67, 67)
                                .addComponent(cart41, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, ParticionGuiLayout.createSequentialGroup()
                                .addComponent(Labelagrup4)
                                .addGap(18, 18, 18)
                                .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(cart31, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, ParticionGuiLayout.createSequentialGroup()
                                .addComponent(Labelagrup2)
                                .addGap(18, 18, 18)
                                .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(cart21, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, ParticionGuiLayout.createSequentialGroup()
                                .addComponent(Labelagrup1)
                                .addGap(18, 18, 18)
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(cart11, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addComponent(cart12, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart13, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart14, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart15, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart16, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart17, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE))
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cart42, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                    .addComponent(cart32, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                    .addComponent(cart22, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                    .addComponent(cart52, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cart33, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                    .addComponent(cart23, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cart34, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                    .addComponent(cart24, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart25, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart26, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cart27, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)))
                        .addGap(158, 158, 158))))
        );
        ParticionGuiLayout.setVerticalGroup(
            ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ParticionGuiLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(Aceptarparticion)
                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(38, 38, 38)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Labelagrup1)
                            .addComponent(cart11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Labelagrup2)
                            .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart25, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart27, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Labelagrup4)
                            .addComponent(cart31, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart33, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart34, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Labelagrup3)
                            .addComponent(cart41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart42, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(Labelagrup5)
                            .addComponent(cart51, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cart52, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(43, 43, 43)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(n14, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(n15, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(n16, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addGap(8, 8, 8))
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(n17)
                                    .addGroup(ParticionGuiLayout.createSequentialGroup()
                                        .addComponent(n18)
                                        .addGap(3, 3, 3)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(Carta01, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta02, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta03, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta04, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta05, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(Carta06, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta07, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta08, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta09, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(Carta010, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(ParticionGuiLayout.createSequentialGroup()
                                .addGap(52, 52, 52)
                                .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(Carta011, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(n12))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(n13)
                            .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(n19)
                                .addComponent(n20))
                            .addGroup(ParticionGuiLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(n21)
                                .addComponent(n22)))))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 599, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(JugadorGui, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(TurnoGui, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(GuardarNombreGui, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(ParticionGui, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 533, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(JugadorGui, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(TurnoGui, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(GuardarNombreGui, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(ParticionGui, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BarajaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BarajaActionPerformed
        // TODO add your handling code here:
        jug = new Jugada(0);
        decision = true;
        partida.jugar(1);
}//GEN-LAST:event_BarajaActionPerformed

    public void mostrarparticion(){
        JugadorGui.setVisible(false);
        ParticionGui.setVisible(true);
        this.getRootPane().setContentPane(ParticionGui);
        setactiongroupone(2);
        setactiongrouptwo(2);
        setactiongroupthree(2);
        setactiongroup(2);
    }

    private void CerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CerrarActionPerformed
        // TODO add your handling code here:
        JugadorGui.setVisible(false);
        ParticionGui.setVisible(true);
        this.getRootPane().setContentPane(ParticionGui);
        setactiongroupone(2);
        setactiongrouptwo(2);
        setactiongroupthree(2);
        setactiongroup(2);
}//GEN-LAST:event_CerrarActionPerformed

    private void DescartarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DescartarActionPerformed
        // TODO add your handling code here:
        try {
            jug = new Jugada(1, Integer.parseInt(NDescartar.getText()));
            if (Integer.parseInt(NDescartar.getText())>0 && Integer.parseInt(NDescartar.getText())<12){
                decision = true;
                partida.jugar(4);
            }
            else{
                errordescarte.setVisible(true);
            }
        }
        catch (Exception e){
          e.printStackTrace();
            errordescarte.setVisible(true);
        }
        
}//GEN-LAST:event_DescartarActionPerformed

    private void CambioCarta12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta12ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(1, 2);
        this.actualiza_cartas(mano,diezcartas);
}//GEN-LAST:event_CambioCarta12ActionPerformed

    private void DescarteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DescarteActionPerformed
        // TODO add your handling code here:
        ImageIcon c = new ImageIcon(getClass().getResource("cartas/reverso.gif"));
        Descarte.setIcon(c);
        jug = new Jugada(1);
        decision = true;
        partida.jugar(1);
}//GEN-LAST:event_DescarteActionPerformed

    private void MostrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MostrarActionPerformed
        // TODO add your handling code here:
        JugadorGui.setVisible(true);
        TurnoGui.setVisible(false);
        this.getRootPane().setContentPane(JugadorGui);
    }//GEN-LAST:event_MostrarActionPerformed

    private void CambioCarta23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta23ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(2, 3);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta23ActionPerformed

    private void CambioCarta34ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta34ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(3, 4);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta34ActionPerformed

    private void CambioCarta45ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta45ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(4, 5);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta45ActionPerformed

    private void CambioCarta67ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta67ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(6, 7);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta67ActionPerformed

    private void CambioCarta78ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta78ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(7, 8);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta78ActionPerformed

    private void CambioCarta89ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta89ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(8, 9);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta89ActionPerformed

    private void CambioCarta910ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta910ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(9, 10);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta910ActionPerformed

    private void CambioCarta511ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta511ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(5, 11);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta511ActionPerformed

    private void CambioCarta1011ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CambioCarta1011ActionPerformed
        // TODO add your handling code here:
        jugador.Reordenar(10, 11);
        this.actualiza_cartas(mano,diezcartas);
    }//GEN-LAST:event_CambioCarta1011ActionPerformed

    private void BotonAbortarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonAbortarActionPerformed
        // TODO add your handling code here:
        padre.abortar();
    }//GEN-LAST:event_BotonAbortarActionPerformed

    private void BotonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonGuardarActionPerformed
        // TODO add your handling code here:
        GuardarNombreGui.setVisible(true);
        JugadorGui.setVisible(false);
        this.getRootPane().setContentPane(GuardarNombreGui);
    }//GEN-LAST:event_BotonGuardarActionPerformed

    private void CancelarGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelarGuardarActionPerformed
        // TODO add your handling code here:
        GuardarNombreGui.setVisible(false);
        JugadorGui.setVisible(true);
        this.getRootPane().setContentPane(JugadorGui);
    }//GEN-LAST:event_CancelarGuardarActionPerformed

    private void aceptarguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarguardarActionPerformed
        // TODO add your handling code here:
        padre.guardar(nombrepart.getText());
        padre.abortar();
    }//GEN-LAST:event_aceptarguardarActionPerformed

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
        // TODO add your handling code here:
        int i = Integer.parseInt((String)jComboBox1.getSelectedItem());
        setactiongroup(i);
    }//GEN-LAST:event_jComboBox1ActionPerformed

    private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
        // TODO add your handling code here:
        int i = Integer.parseInt((String)jComboBox2.getSelectedItem());
        setactiongroupone(i);
    }//GEN-LAST:event_jComboBox2ActionPerformed

    private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed
        // TODO add your handling code here:
        int i = Integer.parseInt((String)jComboBox3.getSelectedItem());
        setactiongrouptwo(i);
    }//GEN-LAST:event_jComboBox3ActionPerformed

    private void jComboBox5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox5ActionPerformed
        // TODO add your handling code here:
        int i = Integer.parseInt((String)jComboBox5.getSelectedItem());
        setactiongroupthree(i);
    }//GEN-LAST:event_jComboBox5ActionPerformed

    private void AceptarparticionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AceptarparticionActionPerformed
        // TODO add your handling code here:
        int particions = Integer.parseInt((String)jComboBox1.getSelectedItem());
        ArrayList<int[]> p = new ArrayList<int[]>(particions);
        if (particions >= 2){
            //mirem la 1a particio
            int particio1 = Integer.parseInt((String)jComboBox2.getSelectedItem());
            int[] p1 = new int[particio1];
            if (particio1 >= 2){
                p1[0] = Integer.parseInt(cart11.getText());
                p1[1] = Integer.parseInt(cart12.getText());
            }
            if (particio1 >= 3){
                p1[2] = Integer.parseInt(cart13.getText());
            }
            if (particio1 >= 4){
                p1[3] = Integer.parseInt(cart14.getText());
            }
            if (particio1 >= 5){
                p1[4] = Integer.parseInt(cart15.getText());
            }
            if (particio1 >= 6){
                p1[5] = Integer.parseInt(cart16.getText());
            }
            if (particio1 == 7){
                p1[6] = Integer.parseInt(cart17.getText());
            }
            p.add(p1);
            //mirem la 2a particio
            int particio2 = Integer.parseInt((String)jComboBox3.getSelectedItem());
            int[] p2 = new int[particio2];
            if (particio2 >= 2){
                p2[0] = Integer.parseInt(cart21.getText());
                p2[1] = Integer.parseInt(cart22.getText());
            }
            if (particio2 >= 3){
                p2[2] = Integer.parseInt(cart23.getText());
            }
            if (particio2 >= 4){
                p2[3] = Integer.parseInt(cart24.getText());
            }
            if (particio2 >= 5){
                p2[4] = Integer.parseInt(cart25.getText());
            }
            if (particio2 >= 6){
                p2[5] = Integer.parseInt(cart26.getText());
            }
            if (particio2 == 7){
                p2[6] = Integer.parseInt(cart27.getText());
            }
            p.add(p2);
        }
        if (particions >= 3){
            //mirem la 3a partició
            int particio3 = Integer.parseInt((String)jComboBox5.getSelectedItem());
            int[] p3 = new int[particio3];
            if (particio3 >= 2){
                p3[0] = Integer.parseInt(cart31.getText());
                p3[1] = Integer.parseInt(cart32.getText());
            }
            if (particio3 >= 3){
                p3[2] = Integer.parseInt(cart33.getText());
            }
            if (particio3 >= 4){
                p3[3] = Integer.parseInt(cart34.getText());
            }
            p.add(p3);
        }
        if (particions == 5){
            //mirem la 4a partició
            int[] p4 = new int[2];
            p4[0] = Integer.parseInt(cart41.getText());
            p4[1] = Integer.parseInt(cart42.getText());
            p.add(p4);
            //mirem la 5a partició
            int[] p5 = new int[2];
            p5[0] = Integer.parseInt(cart51.getText());
            p5[1] = Integer.parseInt(cart52.getText());
            p.add(p5);
        }
        jug = new Jugada(0, p);
        decision = true;
        partida.juega_actualiza(4);
    }//GEN-LAST:event_AceptarparticionActionPerformed

    public JugadorRemigio getJugador(){
        return jugador;
    }
    public void setjugador(JugadorRemigio jugador){
        this.jugador = jugador;
    }
    public void setpartida(PartidaRemigio partida){
        this.partida=partida;
    }

    
    public boolean getdecision(){
        return decision;
    }
    public void setdecision(boolean b){
        decision = b;
    }
    public Jugada getjugada(){
        return jug;
    }
    /**
     * Devuelve el nombre para buscar la imagen de la carta
     * @param nombre es el nuevo nombre
     * @return
     */
    public String nombrecarta (String nombre){
        if (nombre.equals("Picas")){
            return "P.gif";
        }
        else if (nombre.equals("Corazones")){
            return "C.gif";
        }
        else if (nombre.equals("Diamantes")){
            return "D.gif";
        }
        else if (nombre.equals("Treboles")){
            return "T.gif";
        }
        return "a.gif";
    }

    /**
     * Actualiza los campos de las puntuaciones y nombres de la pantalla JugadorGui
     */
    public void actualiza_puntuaciones(PartidaRemigio partida){

        //Nº del jugador que estamos tratando
        int i = 3;
        //ponemos la info del jugador 1
        if (partida.VerJugador(0).EsHumano()){
            InfoJug1.setText(partida.VerJugador(0).GetUser().getLogin());
        }
        else {
            InfoJug1.setText("maquina 1");
        }
        PuntJug1.setText(Integer.toString(partida.VerJugador(0).GetPuntos()));
        //ponemos la info del jugador 2
        if (partida.VerJugador(1).EsHumano()){
            InfoJug2.setText(partida.VerJugador(1).GetUser().getLogin());
        }
        else {
            InfoJug2.setText("maquina 2");
        }
        PuntJug2.setText(Integer.toString(partida.VerJugador(1).GetPuntos()));
        //ponemos la info del jugador 3
        if (i<=partida.getNumJugadores()){
            InfoJug3.setVisible(true);
            PuntJug3.setVisible(true);
            i++;
            if (partida.VerJugador(2).EsHumano()){
                InfoJug3.setText(partida.VerJugador(2).GetUser().getLogin());
            }
            else {
                InfoJug3.setText("maquina 3");
            }
            PuntJug3.setText(Integer.toString(partida.VerJugador(2).GetPuntos()));
        }
        else {
            InfoJug3.setVisible(false);
            PuntJug3.setVisible(false);
        }
        //ponemos la info del jugador 4
        if (i<=partida.getNumJugadores()){
            InfoJug4.setVisible(true);
            PuntJug4.setVisible(true);
            i++;
            if (partida.VerJugador(3).EsHumano()){
                InfoJug4.setText(partida.VerJugador(3).GetUser().getLogin());
            }
            else {
                InfoJug4.setText("maquina 4");
            }
            PuntJug4.setText(Integer.toString(partida.VerJugador(3).GetPuntos()));
        }
        else {
            InfoJug4.setVisible(false);
            PuntJug4.setVisible(false);
        }
        //ponemos la info del jugador 5
        if (i<=partida.getNumJugadores()){
            InfoJug5.setVisible(true);
            PuntJug5.setVisible(true);
            i++;
            if (partida.VerJugador(4).EsHumano()){
                InfoJug5.setText(partida.VerJugador(4).GetUser().getLogin());
            }
            else {
                InfoJug5.setText("maquina 5");
            }
            PuntJug5.setText(Integer.toString(partida.VerJugador(4).GetPuntos()));
        }
        else {
            InfoJug5.setVisible(false);
            PuntJug5.setVisible(false);
        }
        //ponemos la info del jugador 6
        if (i<=partida.getNumJugadores()){
            InfoJug6.setVisible(true);
            PuntJug6.setVisible(true);
            i++;
            if (partida.VerJugador(5).EsHumano()){
                InfoJug6.setText(partida.VerJugador(5).GetUser().getLogin());
            }
            else {
                InfoJug6.setText("maquina 6");
            }
            PuntJug6.setText(Integer.toString(partida.VerJugador(5).GetPuntos()));
        }
        else {
            InfoJug6.setVisible(false);
            PuntJug6.setVisible(false);
        }
        //ponemos la info del jugador 7
        if (i<=partida.getNumJugadores()){
            InfoJug7.setVisible(true);
            PuntJug7.setVisible(true);
            i++;
            if (partida.VerJugador(6).EsHumano()){
                InfoJug7.setText(partida.VerJugador(6).GetUser().getLogin());
            }
            else {
                InfoJug7.setText("maquina 7");
            }
            PuntJug7.setText(Integer.toString(partida.VerJugador(6).GetPuntos()));
        }
        else {
            InfoJug7.setVisible(false);
            PuntJug7.setVisible(false);
        }
    }

    /**
     * Actualiza las cartas de la pantalla JugadorGui y ParticionGui
     * @param b cierto si hay 10 cartas, falso si tenemos 11
     */
    public void actualiza_cartas(Mazo mano, boolean b){
        this.mano=mano;
        this.diezcartas=b;
        CambioCarta511.setEnabled(false);
        CambioCarta1011.setEnabled(false);
        //actualizamos la carta 1
        String directori = "cartas/";
        String cart = mano.consultar_cvalor(1) + nombrecarta(mano.consultar_cpalo(1));
        ImageIcon c = new ImageIcon (getClass().getResource(directori + cart));
        Carta1.setIcon(c);
        Carta01.setIcon(c);
        //actualizamos la carta 2
        cart = mano.consultar_cvalor(2) + nombrecarta(mano.consultar_cpalo(2));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta2.setIcon(c);
        Carta02.setIcon(c);
        //actualizamos la carta 3
        cart = mano.consultar_cvalor(3) + nombrecarta(mano.consultar_cpalo(3));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta3.setIcon(c);
        Carta03.setIcon(c);
        //actualizamos la carta 4
        cart = mano.consultar_cvalor(4) + nombrecarta(mano.consultar_cpalo(4));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta4.setIcon(c);
        Carta04.setIcon(c);
        //actualizamos la carta 5
        cart = mano.consultar_cvalor(5) + nombrecarta(mano.consultar_cpalo(5));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta5.setIcon(c);
        Carta05.setIcon(c);
        //actualizamos la carta 6
        cart = mano.consultar_cvalor(6) + nombrecarta(mano.consultar_cpalo(6));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta6.setIcon(c);
        Carta06.setIcon(c);
        //actualizamos la carta 7
        cart = mano.consultar_cvalor(7) + nombrecarta(mano.consultar_cpalo(7));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta7.setIcon(c);
        Carta07.setIcon(c);
        //actualizamos la carta 8
        cart = mano.consultar_cvalor(8) + nombrecarta(mano.consultar_cpalo(8));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta8.setIcon(c);
        Carta08.setIcon(c);
        //actualizamos la carta 9
        cart = mano.consultar_cvalor(9) + nombrecarta(mano.consultar_cpalo(9));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta9.setIcon(c);
        Carta09.setIcon(c);
        //actualizamos la carta 10
        cart = mano.consultar_cvalor(10) + nombrecarta(mano.consultar_cpalo(10));
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta10.setIcon(c);
        Carta010.setIcon(c);
        //ponemos que no se vea la carta 11
        cart = "reverso.gif";
        c = new ImageIcon (getClass().getResource(directori + cart));
        Carta11.setIcon(c);
        Carta011.setIcon(c);
        if (!b){
            CambioCarta511.setEnabled(true);
            CambioCarta1011.setEnabled(true);
            //actualizamos la carta 11
            cart = mano.consultar_cvalor(11) + nombrecarta(mano.consultar_cpalo(11));
            c = new ImageIcon (getClass().getResource(directori + cart));
            Carta11.setIcon(c);
            Carta011.setIcon(c);
        }
    }

    public void set_descarte (Carta descarte){
        String directori = "cartas/";
        String cart = descarte.getValor() + nombrecarta(descarte.getPalo());
        ImageIcon c = new ImageIcon (getClass().getResource(directori + cart));
        Descarte.setIcon(c);
    }

    /**
     *
     * @param b true usamos baraja o descarte;;false usamos descartar o cerrar
     */
    public void set_visibilidad(boolean b){
        if (b){
            NDescartar.setEnabled(false);
            Descartar.setEnabled(false);
            Cerrar.setEnabled(false);
            Baraja.setEnabled(true);
            Descarte.setEnabled(true);
            BotonGuardar.setEnabled(true);
        }
        else {
            NDescartar.setEnabled(true);
            Descartar.setEnabled(true);
            Cerrar.setEnabled(true);
            Baraja.setEnabled(false);
            Descarte.setEnabled(false);
            BotonGuardar.setEnabled(false);
        }
    }

    /**
     * Función que actualiza el nombre del jugador
     * @param nom nombre del jugador
     */
    public void setnombre (String nom){
        NombreJugador.setText(nom);
    }

    /**
     * Ponemos al padre correcto
     * @param padre
     */
    public void setpadre(GUIRemigio padre){
        this.padre = padre;
    }

    /**
     * Activa o descativa el uso de las agrupaciones de cartas
     * @param i es el numero de agrupaciones activas(solo pueden ser 2,3 o 5)
     */
    public void setactiongroup(int i){
        if (i==2){
            jComboBox5.setEnabled(false);
            cart31.setEnabled(false);
            cart32.setEnabled(false);
            cart33.setEnabled(false);
            cart34.setEnabled(false);
            cart41.setEnabled(false);
            cart42.setEnabled(false);
            cart51.setEnabled(false);
            cart52.setEnabled(false);
        }
        else if(i==3){
            jComboBox5.setEnabled(true);
            cart31.setEnabled(true);
            cart32.setEnabled(true);
            cart33.setEnabled(false);
            cart34.setEnabled(false);
            cart41.setEnabled(false);
            cart42.setEnabled(false);
            cart51.setEnabled(false);
            cart52.setEnabled(false);
        }
        else if(i==5){
            jComboBox5.setEnabled(true);
            cart31.setEnabled(true);
            cart32.setEnabled(true);
            cart33.setEnabled(false);
            cart34.setEnabled(false);
            cart41.setEnabled(true);
            cart42.setEnabled(true);
            cart51.setEnabled(true);
            cart52.setEnabled(true);
        }
    }

    /**
     * Activa o descativa el uso de las casillas de cartas de la 1a particion
     * @param i es el numero de casillas activas(solo pueden ser 2, 3, 4, 5, 6 o 7)
     */
    public void setactiongroupone(int i){
        if (i==2){
            cart13.setEnabled(false);
            cart14.setEnabled(false);
            cart15.setEnabled(false);
            cart16.setEnabled(false);
            cart17.setEnabled(false);
        }
        else if (i==3){
            cart13.setEnabled(true);
            cart14.setEnabled(false);
            cart15.setEnabled(false);
            cart16.setEnabled(false);
            cart17.setEnabled(false);
        }
        else if (i==4){
            cart13.setEnabled(true);
            cart14.setEnabled(true);
            cart15.setEnabled(false);
            cart16.setEnabled(false);
            cart17.setEnabled(false);
        }
        else if (i==5){
            cart13.setEnabled(true);
            cart14.setEnabled(true);
            cart15.setEnabled(true);
            cart16.setEnabled(false);
            cart17.setEnabled(false);
        }
        else if (i==6){
            cart13.setEnabled(true);
            cart14.setEnabled(true);
            cart15.setEnabled(true);
            cart16.setEnabled(true);
            cart17.setEnabled(false);
        }
        else if (i==7){
            cart13.setEnabled(true);
            cart14.setEnabled(true);
            cart15.setEnabled(true);
            cart16.setEnabled(true);
            cart17.setEnabled(true);
        }
    }

    /**
     * Activa o descativa el uso de las casillas de cartas de la 2a particion
     * @param i es el numero de casillas activas(solo pueden ser 2, 3, 4, 5, 6 o 7)
     */
    public void setactiongrouptwo(int i){
        if (i==2){
            cart23.setEnabled(false);
            cart24.setEnabled(false);
            cart25.setEnabled(false);
            cart26.setEnabled(false);
            cart27.setEnabled(false);
        }
        else if (i==3){
            cart23.setEnabled(true);
            cart24.setEnabled(false);
            cart25.setEnabled(false);
            cart26.setEnabled(false);
            cart27.setEnabled(false);
        }
        else if (i==4){
            cart23.setEnabled(true);
            cart24.setEnabled(true);
            cart25.setEnabled(false);
            cart26.setEnabled(false);
            cart27.setEnabled(false);
        }
        else if (i==5){
            cart23.setEnabled(true);
            cart24.setEnabled(true);
            cart25.setEnabled(true);
            cart26.setEnabled(false);
            cart27.setEnabled(false);
        }
        else if (i==6){
            cart23.setEnabled(true);
            cart24.setEnabled(true);
            cart25.setEnabled(true);
            cart26.setEnabled(true);
            cart27.setEnabled(false);
        }
        else if (i==7){
            cart23.setEnabled(true);
            cart24.setEnabled(true);
            cart25.setEnabled(true);
            cart26.setEnabled(true);
            cart27.setEnabled(true);
        }
    }

    /**
     * Activa o descativa el uso de las casillas de cartas de la 3a particion
     * @param i es el numero de casillas activas(solo pueden ser 2, 3 o 4)
     */
    public void setactiongroupthree(int i){
        if (i==2){
            cart33.setEnabled(false);
            cart34.setEnabled(false);
        }
        else if (i==3){
            cart33.setEnabled(true);
            cart34.setEnabled(false);
        }
        else if (i==4){
            cart33.setEnabled(true);
            cart34.setEnabled(true);
        }
    }
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    protected javax.swing.JButton Aceptarparticion;
    protected javax.swing.JButton Baraja;
    protected javax.swing.JButton BotonAbortar;
    protected javax.swing.JButton BotonGuardar;
    protected javax.swing.JButton CambioCarta1011;
    protected javax.swing.JButton CambioCarta12;
    protected javax.swing.JButton CambioCarta23;
    protected javax.swing.JButton CambioCarta34;
    protected javax.swing.JButton CambioCarta45;
    protected javax.swing.JButton CambioCarta511;
    protected javax.swing.JButton CambioCarta67;
    protected javax.swing.JButton CambioCarta78;
    protected javax.swing.JButton CambioCarta89;
    protected javax.swing.JButton CambioCarta910;
    protected javax.swing.JButton CancelarGuardar;
    protected javax.swing.JLabel Carta01;
    protected javax.swing.JLabel Carta010;
    protected javax.swing.JLabel Carta011;
    protected javax.swing.JLabel Carta02;
    protected javax.swing.JLabel Carta03;
    protected javax.swing.JLabel Carta04;
    protected javax.swing.JLabel Carta05;
    protected javax.swing.JLabel Carta06;
    protected javax.swing.JLabel Carta07;
    protected javax.swing.JLabel Carta08;
    protected javax.swing.JLabel Carta09;
    protected javax.swing.JLabel Carta1;
    protected javax.swing.JLabel Carta10;
    protected javax.swing.JLabel Carta11;
    protected javax.swing.JLabel Carta2;
    protected javax.swing.JLabel Carta3;
    protected javax.swing.JLabel Carta4;
    protected javax.swing.JLabel Carta5;
    protected javax.swing.JLabel Carta6;
    protected javax.swing.JLabel Carta7;
    protected javax.swing.JLabel Carta8;
    protected javax.swing.JLabel Carta9;
    protected javax.swing.JButton Cerrar;
    protected javax.swing.JButton Descartar;
    protected javax.swing.JButton Descarte;
    protected javax.swing.JPanel GuardarNombreGui;
    protected javax.swing.JLabel InfoJug1;
    protected javax.swing.JLabel InfoJug2;
    protected javax.swing.JLabel InfoJug3;
    protected javax.swing.JLabel InfoJug4;
    protected javax.swing.JLabel InfoJug5;
    protected javax.swing.JLabel InfoJug6;
    protected javax.swing.JLabel InfoJug7;
    protected javax.swing.JPanel JugadorGui;
    protected javax.swing.JLabel Labelagrup1;
    protected javax.swing.JLabel Labelagrup2;
    protected javax.swing.JLabel Labelagrup3;
    protected javax.swing.JLabel Labelagrup4;
    protected javax.swing.JLabel Labelagrup5;
    protected javax.swing.JButton Mostrar;
    protected javax.swing.JTextField NDescartar;
    protected javax.swing.JLabel NombreJugador;
    protected javax.swing.JPanel ParticionGui;
    protected javax.swing.JLabel PuntJug1;
    protected javax.swing.JLabel PuntJug2;
    protected javax.swing.JLabel PuntJug3;
    protected javax.swing.JLabel PuntJug4;
    protected javax.swing.JLabel PuntJug5;
    protected javax.swing.JLabel PuntJug6;
    protected javax.swing.JLabel PuntJug7;
    protected javax.swing.JPanel TurnoGui;
    protected javax.swing.JButton aceptarguardar;
    protected javax.swing.JTextField cart11;
    protected javax.swing.JTextField cart12;
    protected javax.swing.JTextField cart13;
    protected javax.swing.JTextField cart14;
    protected javax.swing.JTextField cart15;
    protected javax.swing.JTextField cart16;
    protected javax.swing.JTextField cart17;
    protected javax.swing.JTextField cart21;
    protected javax.swing.JTextField cart22;
    protected javax.swing.JTextField cart23;
    protected javax.swing.JTextField cart24;
    protected javax.swing.JTextField cart25;
    protected javax.swing.JTextField cart26;
    protected javax.swing.JTextField cart27;
    protected javax.swing.JTextField cart31;
    protected javax.swing.JTextField cart32;
    protected javax.swing.JTextField cart33;
    protected javax.swing.JTextField cart34;
    protected javax.swing.JTextField cart41;
    protected javax.swing.JTextField cart42;
    protected javax.swing.JTextField cart51;
    protected javax.swing.JTextField cart52;
    protected javax.swing.JLabel errordescarte;
    protected javax.swing.JComboBox jComboBox1;
    protected javax.swing.JComboBox jComboBox2;
    protected javax.swing.JComboBox jComboBox3;
    protected javax.swing.JComboBox jComboBox5;
    protected javax.swing.JLabel jLabel1;
    protected javax.swing.JLabel jLabel2;
    protected javax.swing.JLabel jLabel22;
    protected javax.swing.JLabel jLabel24;
    protected javax.swing.JLabel jLabel3;
    protected javax.swing.JLabel jLabel4;
    protected javax.swing.JLabel jLabel5;
    protected javax.swing.JLabel n1;
    protected javax.swing.JLabel n10;
    protected javax.swing.JLabel n11;
    protected javax.swing.JLabel n12;
    protected javax.swing.JLabel n13;
    protected javax.swing.JLabel n14;
    protected javax.swing.JLabel n15;
    protected javax.swing.JLabel n16;
    protected javax.swing.JLabel n17;
    protected javax.swing.JLabel n18;
    protected javax.swing.JLabel n19;
    protected javax.swing.JLabel n2;
    protected javax.swing.JLabel n20;
    protected javax.swing.JLabel n21;
    protected javax.swing.JLabel n22;
    protected javax.swing.JLabel n3;
    protected javax.swing.JLabel n4;
    protected javax.swing.JLabel n5;
    protected javax.swing.JLabel n6;
    protected javax.swing.JLabel n7;
    protected javax.swing.JLabel n8;
    protected javax.swing.JLabel n9;
    protected javax.swing.JTextField nombrepart;
    // End of variables declaration//GEN-END:variables

}
